package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.entity.Reservation;
import com.zzyl.vo.AppointmentTimesVo;
import com.zzyl.vo.ReservationVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface CustomerReservationMapper {
    /**
     * 新增预约
     *
     * @param reservation
     */
    void add(Reservation reservation);

    /**
     * 分页查询预约
     *
     * @param status
     * @return
     */
    Page<ReservationVo> PaginationQuery(Integer status);

    /**
     * 取消预约
     *
     * @param id
     */
    void cancelReservation(Long id);



    /**
     * 查询取消预约数量
     *
     * @return
     */
//    int countCancelledReservationsWithinTimeRange(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, @Param("updateBy") Long updateBy);
    String countCancelledReservationsWithinTimeRange(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, @Param("updateBy") Long updateBy);




    /**
     * 查询每个时间段剩余预约次数
     *
     * @return
     */
    List<Map<String, Object>> countByTime(LocalDateTime startTime, LocalDateTime endTime);
}
